<script type="text/javascript">
$(document).ready(function() {


	$('#conversation').html('3');
	   //listen for the form beeing submitted
	   $("#myForm").submit(function(){
	      //get the url for the form
	      //var url=$("#myForm").attr("action");
	   		var url = {{ app.request.uri }};
	      //start send the post request
	       $.post(url,{formName:$("#nameid").val(), other:"attributes" },function(data){
	           //the response is in the data variable
	   
	            if(data.response==200 ){           
	                $('#output').html(data.index);
	                $('#output').css("color","red");
	            }
	           else if(data.response==400){//bad request
	               $('#output').html(data.index);
	               $('#output').css("color","red");
	          }
	       
	       },"json");//make sure the the response is in json format

	      //we dont what the browser to submit the form
	      return false;
	   });



	   function timer()
		{
			var dt=new Date();	
			
			
			//alert(dt.getSeconds());
			if(dt.getSeconds() == 30 || dt.getSeconds() == 11 || dt.getSeconds() == 13 || dt.getSeconds() == 14 || dt.getSeconds() == 2)
			{
				$('#alertnotif').fadeTo("slow", 1);
				$('#alertnbr').html('3');
				$('#alertnbr').addClass('nbr');
				$('#alertnbr').effect("bounce", { times:3 }, 300);
			}	

			alert('test');
				
			
			
			setTimeout(timer, 2000);
		}
	  	timer();


	});


<!--

//-->
</script>




<h1>Employee list</h1>{{ app.request.uri }}
<div id="content">
  <form id="myForm" action="" method="POST" >
    Write your name here: 
    <input type="text" name="name" id="nameId" value="" /><br />
    <input type="submit" value="Send" />
  </form>
 </div>
 <div id="output">{{ name }}</div>
</div>



<table class="records_list">
    <thead>
        <tr>
            <th>Id</th>
            <th>Nom</th>
            <th>Prenom</th>
            <th>Age</th>
            <th>Salaire</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
    {% for entity in entities %}
        <tr>
            <td><a href="{{ path('employee_show', { 'id': entity.id }) }}">{{ entity.id }}</a></td>
            <td>{{ entity.nom }}</td>
            <td>{{ entity.prenom }}</td>
            <td>{{ entity.age }}</td>
            <td>{{ entity.salaire }}</td>
            <td>
                <ul>
                    <li>
                        <a href="{{ path('employee_show', { 'id': entity.id }) }}">show</a>
                    </li>
                    <li>
                        <a href="{{ path('employee_edit', { 'id': entity.id }) }}">edit</a>
                    </li>
                </ul>
            </td>
        </tr>
    {% endfor %}
    </tbody>
</table>

<ul>
    <li>
        <a href="{{ path('employee_new') }}">
            Create a new entry
        </a>
    </li>
</ul>
